<template>
	<view class="all">
		<view class="bac">
			<view class="item">
				<view class="" style="display: flex;">
					<view class="left">
						<image style="width: 60rpx;height: 60rpx;" src="@/static/img/my_order_btn_pending.png" mode=""></image>
					</view>
					<view class="right">
						<view class="line_1">
							待处理 -
							<text v-if="dataList.refundNot==2&&dataList.renewalNot==0">提前退房</text>
							<text v-if="dataList.refundNot==0&&dataList.renewalNot==2">续费入住</text>
						</view>
						<view class="line_2">
							申请日期：{{dataList.refundTime}}
						</view>
					</view>
				</view>
				<view class="roomNum">
					房间号：{{dataList.roomNum}}
				</view>
			</view>
			<view class="detials">
				<view class="detial">
					<view class="left">
						<view class="line1">
							{{homeData.home_type}}
						</view>
						<view class="line2">
							{{homeData.home_detail}}
						</view>
					</view>
					<view class="right" @click="toDetial2(dataList.institution_type.id)">
						查看房型
					</view>
				</view>
			</view>
			
		</view>
		<view class="btns1"  v-if="dataList.refundNot==0&&dataList.renewalNot==2">
			<view class="btn2" @click="toAgreen1()">
				<text >同意续费</text>
			</view>
		</view>
		<view class="btns1" v-if="dataList.refundNot==2&&dataList.renewalNot==0">
			<view class="btn3" @click="toRefuse()" >
				<text>拒绝退房</text>
			</view>
			<view class="btn4" @click="toAgreen2()">
				<text>同意退房</text>
			</view>
		</view>
		<view class="orders">
			<view class="orderInfo">
				<view class="">
					订单信息
				</view>
				<view class="" v-if="dataList.refundNot==2&&dataList.renewalNot==0">
					订单编号：{{dataList.order_no}}
				</view>
				<view class="" v-if="dataList.refundNot==2&&dataList.renewalNot==0">
					下单时间：{{dataList.created_at}}
				</view>
				<view class="" v-if="dataList.refundNot==2&&dataList.renewalNot==0">
					支付订金：{{dataList.amount_paid}}
				</view>
				<view class="" v-if="dataList.refundNot==2&&dataList.renewalNot==0">
					支付尾款：{{dataList.wait_pay}}
				</view>
				<view class="">
					入住时间：{{dataList.start_date}}——{{dataList.end_date}}
				</view>
				<view class="">
					联系人：{{dataList.contacts}}
				</view>
				<view class="">
					身份证号码：{{dataList.contacts_card}}
				</view>
				<view class="">
					联系电话：{{dataList.order_phone}}
				</view>
				<view class="">
					备注：{{dataList.order_remark}}
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {getOrderDetail,agreeRenew,agreeRenewDetail,refusalRefund} from '@/utils/api.js'
	export default {
		data() {
			return {
				status:false,
				dataList:{},
				homeData:{},
				orderId:'',
				agreenId:'',
				dataList2:{}
			};
		},
		onLoad(option) {
			console.log(option,'option');
			this.orderId=option.orderId
			getOrderDetail(option).then(res=>{
				if(res.data.meta.status==200){
					this.dataList=res.data.data
					this.homeData=res.data.data.institution_type
				}
			})
			
		},
		onShow() {
			
		},
		methods:{
			toAgreen1(){
				let data={renewalId:this.agreenId}
				agreeRenew(data).then(res=>{
					if(res.data.meta.status==200){
						uni.showToast({
							title:'已通知客户入同意续费，等待付款',
							icon:'none'
						})
					}
				})
				
			},
			toRefuse(){
				refusalRefund({refundId:this.orderId}).then(res=>{
					
				})
			},
			toAgreen2(){
				uni.navigateTo({
					url:'/pages/order/agreen?orderId='+this.orderId
				})
				// agreeRefund().then(res=>{
					
				// })
				
			},
			toDetial2(id){
				console.log(id,'ddd');
				uni.navigateTo({
					url:'/pages/room/roomDetial2?homeTypeId='+id
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.all{
		.bac{
			height: 256rpx;
			background: #FF8330;
			position: relative;
			.item{
				height: 100rpx;
				position: absolute;
				top: 20rpx;
				right: 0;
				left: 0;
				padding: 52rpx 48rpx;
				display: flex;
				justify-content: space-between;
				.left{
					width: 60rpx;
					height: 60rpx;
					line-height: 80rpx;
				}
				.right{
					margin-left: 20rpx;
					margin-top: -20rpx;
					color: white;
					.line_1{
						font-size: 36rpx;
						font-weight: bold;
						color: #FFFFFF;
					}
					.line_2{
						font-size: 26rpx;
						font-weight: 500;
						color: #FFFFFF;
					}
				}
				.roomNum{
					color: white;
					font-size: 32rpx;
					font-weight: bold;
					color: #FFFFFF;
				}
			}
			.detials{
				// padding: 0 24rpx 0 24rpx;
				height: 152rpx;
				width: 100%;
				position: absolute;
				bottom: -76rpx;
				.detial{
					margin: 0 24rpx;
					height: 152rpx;
					background: #FFFFFF;
					border-radius: 16rpx;
					display: flex;
					.left{
						width: 75%;
						margin-left: 24rpx;
						line-height: 45rpx;
						margin-top: 35rpx;
						.line1{
							font-size: 32rpx;
							font-weight: bold;
							color: #242424;
						}
						.line2{
							font-size: 24rpx;
							font-weight: bold;
							color: #686868;
							overflow: hidden;
							white-space: nowrap;
							text-overflow: ellipsis;
						}
					}
					.right{
						width: 25%;
						text-align: center;
						line-height:152rpx ;
						font-size: 24rpx;
						font-weight: bold;
						color: #5398F6;
					
					}
				}
			}
			
			
		}
		.btns{
			height: 300rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			.btn{
				width: 462rpx;
				height: 88rpx;
				background: #FF8330;
				border-radius: 44rpx;
				text-align: center;
				line-height: 88rpx;
				font-size: 32rpx;
				font-weight: bold;
				color: #FEFEFE;
				margin-top: 100rpx;
			}
		}
		.btns1{
			height: 300rpx;
			display: flex;
			justify-content: space-around;
			align-items: center;
			
			.btn1{
				width: 462rpx;
				height: 90rpx;
				border-radius: 44rpx;
				text-align: center;
				line-height: 88rpx;
				font-size: 32rpx;
				font-weight: bold;
				color: #5398F6;
				margin-top: 100rpx;
				border: 1px solid #5398F6;
			}
			.btn2{
				width: 462rpx;
				height: 90rpx;
				background: #FF8330;
				border-radius: 44rpx;
				text-align: center;
				line-height: 88rpx;
				font-size: 32rpx;
				font-weight: bold;
				color: #FEFEFE;
				margin-top: 100rpx;
			}
			.btn3{
				width: 287rpx;
				height: 90rpx;
				background: #FFFFFF;
				border-radius: 44rpx;
				border: 2rpx solid #FF8330;
				text-align: center;
				line-height: 88rpx;
				font-size: 32rpx;
				font-weight: bold;
				color: #FF8330;
				margin-top: 100rpx;
			}
			.btn4{
				width: 287rpx;
				height: 90rpx;
				background: #FF8330;
				border-radius: 44rpx;
				text-align: center;
				line-height: 88rpx;
				font-size: 32rpx;
				font-weight: bold;
				color: #FEFEFE;
				margin-top: 100rpx;
			}
		}
		.orders{
			padding: 0 24rpx;
			.orderInfo{
				border-radius: 16rpx;	
				background-color: #FFFFFF;	
				padding: 40rpx 24rpx;
			}
			.orderInfo :first-child{
				font-size: 36rpx;
				font-weight: bold;
				color: #242424;
			}
			.orderInfo :not(:first-child){
				font-size: 28rpx;
				font-weight: bold;
				color: #686868;
				line-height: 50rpx;
				margin-top: 20rpx;
			}
		}
		
	}
</style>
